package com.jch.utils;

import org.apache.commons.dbutils.QueryRunner;

import javax.sql.DataSource;

/**
 * QueryRunner工具类
 */
public class QueryRunnerUtils {

    private QueryRunner queryRunner = null;
    private DataSource ds = null;

    //构造方法初始化QueryRunner
    public QueryRunnerUtils() {
        ds = DBPoolUtils.getDataSource();
        if (ds != null) {
            queryRunner = new QueryRunner(ds);
        } else {
            queryRunner = new QueryRunner();
        }
    }

    //获取操作工具
    public QueryRunner getQueryRunner() {
        return queryRunner;
    }

}
